<script setup lang="ts">
const colorBlue = "#487df9";
const colorPink = "#f9487d";
const colorGreen = "green";
</script>

<template>
    <div class="flex justify-center items-center">
    <div class="loader-container">
        <div class="grid-loader" id="girdLoader">
            <div v-for="i in 9" :key="i" class="grid-cell-blue" :style="{ animationDelay: `${(i + 1) * 0.1}s` }">
            </div>
        </div>
    </div>
    <div class="mt-4 mx-4"></div>
     <div class="loader-container">
        <div class="grid-loader" id="girdLoader">
            <div v-for="i in 9" :key="i" class="grid-cell-pink" :style="{ animationDelay: `${(i + 1) * 0.1}s` }">
            </div>
        </div>
    </div>

    <div class="mt-4 mx-4"></div>
     <div class="loader-container">
        <div class="grid-loader" id="girdLoader">
            <div v-for="i in 9" :key="i" class="grid-cell-green" :style="{ animationDelay: `${(i + 1) * 0.1}s` }">
            </div>
        </div>
    </div>
    </div>
</template>

<style scoped lang="scss">
@use "sass:math";

.loader-container {
    display: flex;
    justify-content: center;
    align-items: center;
}


.grid-loader {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    width: 300px;
    height: 300px;
    gap: 10px;
}

.grid-cell-blue {
    background-color: v-bind(colorBlue);
    border-radius: 12px;
    animation: pulse 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    transform: scale(0.6);
    opacity: 0.3;
}

.grid-cell-pink {
    background-color: v-bind(colorPink);
    border-radius: 12px;
    animation: pulse 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    transform: scale(0.6);
    opacity: 0.3;
}

.grid-cell-green {
    background-color: v-bind(colorGreen);
    border-radius: 12px;
    animation: pulse 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    transform: scale(0.6);
    opacity: 0.3;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(0.6);
        opacity: 0.3;
    }

    50% {
        transform: scale(1);
        opacity: 1;
    }
}
</style>
